From: Florian Müllner Date: Mon, 28 Jan 2019 00:37:12 +0000 (+0100) Subject: lint: Allow marking variables/arguments as unused X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~839^2^2~134 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0257de1b7eb160e54e928f499e95dfbec6b634cf;p=gnome-shell.git lint: Allow marking variables/arguments as unused Unused variables or arguments can indicate bugs, but they can also help document the code, in particular in case of signal handlers and destructuring. Account for this by keeping the error, but set up patterns that allow us to opt out of if for individual variables/arguments. For arguments we pick a '_' prefix, while for variables we go with a suffix instead, to not accidentally exempt private module-scope variables. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627 --- diff --git a/lint/eslintrc-shell.json b/lint/eslintrc-shell.json index d8a940bbb..1cae2f4e7 100644 --- a/lint/eslintrc-shell.json +++ b/lint/eslintrc-shell.json @@ -16,6 +16,13 @@ "afterColon": true } ], + "no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "_$" + } + ], "object-curly-spacing": [ "error", "always"